﻿<template>
    <div id="app">
        <mt-header v-bind:title="title" style="background-color:#fda10e">
            <a slot="left" @click="back()">返回</a>

        </mt-header>
        <table class="table table-bordered table-striped">
            <thead>
                <tr>
                    <th>姓名</th>
                    <th>班级</th>
                    <th>是否签到</th>
                    <th>签到时间</th>
                </tr>
            </thead>
            <tbody>
                <tr v-for="item in list">
                    <td>{{item.truename}}</td>
                    <td>{{item.classname}}</td>
                    <td>{{item.ischeck}}</td>
                    <td>{{item.signdate}}</td>
                </tr>

            </tbody>
        </table>


    </div>
</template>

<script>
    import Bus from '../bus.js'
    export default {
        name: 'app',
        data() {
            return {
                title: "统计",
                list:[]
            }
        },
        mounted() {
            window.history.pushState('forward', null, '#');
            window.history.forward(1);
            window.onpopstate = () => {
                Bus.$emit('val', "show");
                this.$router.replace("sign");
            }
        },
        methods: {
            load: function () {
                var classid = this.$route.params.classid;
                var type = this.$route.params.type;
                var mid = window.localStorage.getItem("mid");

                var _this = this;
                this.$api.post('wx/Index/signtj', {
                    "type": type, "mid": mid, "classid": classid
                }, response => {
                    if (response.status >= 200 && response.status < 300) {
                        console.log(response.data);
                        var data = response.data;
                        if (data.status == 200) {

                            _this.$data.list = data.data;

                        }


                        
                    } else {
                        console.log(response.message);
                        //请求失败，response为失败信息
                    }
                });
            },
            back: function () {
                Bus.$emit('val', "show");
                this.$router.replace("sign");

            }
        },
        created: function () {
            this.load();
        }
    }
</script>

<style scoped>
    .table {
        width: 100%;
        margin-top:10px;
    }

        .table tr td {
            width: 25%;
            font-size:12px;
            text-align:center;
        }
</style>